<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%request.setCharacterEncoding("utf-8");%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>安庆地区方言正音电子词典系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
    <style>
        :root {
            --primary-color: #4361ee;
            --secondary-color: #7209b7;
            --accent-color: #f72585;
            --success-color: #4cc9f0;
            --warning-color: #ffd60a;
            --danger-color: #ef476f;
            --info-color: #06d6a0;
            --dark-color: #1d3557;
            --light-color: #f8f9fa;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', sans-serif;
            background-color: #f0f2f5;
            color: var(--dark-color);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }

        .navbar {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            box-shadow: 0 4px 20px rgba(0,0,0,0.15);
            padding: 0.75rem 1.5rem;
            position: sticky;
            top: 0;
            z-index: 1000;
        }

        .navbar-brand {
            font-weight: 700;
            font-size: 1.5rem;
            color: white !important;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .navbar-nav .nav-link {
            color: rgba(255,255,255,0.9) !important;
            font-weight: 500;
            padding: 0.5rem 1rem;
            border-radius: 8px;
            transition: all 0.3s ease;
            margin-left: 5px;
        }

        .navbar-nav .nav-link:hover {
            color: white !important;
            background-color: rgba(255,255,255,0.15);
            transform: translateY(-2px);
        }

        .sidebar {
            background: white;
            box-shadow: 2px 0 15px rgba(0,0,0,0.07);
            height: calc(100vh - 76px);
            overflow-y: auto;
            position: sticky;
            top: 76px;
            transition: all 0.3s ease;
            z-index: 999;
        }

        .sidebar .nav-link {
            color: #4a5568;
            padding: 12px 20px;
            border-radius: 8px;
            margin: 3px 10px;
            transition: all 0.3s ease;
            font-weight: 500;
            display: flex;
            align-items: center;
        }

        .sidebar .nav-link:hover {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            color: white;
            transform: translateX(5px);
        }

        .sidebar .nav-link.active {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            color: white;
        }

        .sidebar .nav-link i {
            margin-right: 12px;
            width: 20px;
            text-align: center;
        }

        .main-content {
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.07);
            margin: 20px;
            height: calc(100vh - 122px);
            transition: all 0.3s ease;
        }

        .main-content:hover {
            box-shadow: 0 8px 30px rgba(0,0,0,0.1);
        }

        .content-frame {
            border: none;
            width: 100%;
            height: 100%;
            border-radius: 12px;
        }

        .footer {
            background: var(--dark-color);
            color: white;
            text-align: center;
            padding: 15px;
            position: fixed;
            bottom: 0;
            width: 100%;
            box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        }

        .user-info {
            color: white;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: rgba(255,255,255,0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            transition: all 0.3s ease;
        }

        .user-avatar:hover {
            transform: scale(1.1);
            background: rgba(255,255,255,0.3);
        }

        .dropdown-menu {
            border-radius: 10px;
            box-shadow: 0 5px 20px rgba(0,0,0,0.15);
            border: none;
            padding: 10px 0;
            overflow: hidden;
            animation: dropdownFade 0.3s ease forwards;
        }

        @keyframes dropdownFade {
            from { opacity: 0; transform: translateY(-10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .dropdown-item {
            padding: 10px 20px;
            transition: all 0.3s ease;
            font-weight: 500;
        }

        .dropdown-item:hover {
            background: var(--light-color);
            color: var(--primary-color);
            transform: translateX(5px);
        }

        .sidebar-header {
            padding: 25px 20px;
            text-align: center;
            border-bottom: 1px solid #eee;
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            color: white;
        }

        .sidebar-header h5 {
            margin: 0;
            font-weight: 700;
            font-size: 1.2rem;
        }

        .nav-section {
            padding: 10px 0;
        }

        .nav-section-title {
            padding: 10px 20px;
            font-size: 0.85rem;
            color: #718096;
            text-transform: uppercase;
            font-weight: 700;
            letter-spacing: 0.5px;
        }

        /* 移动端菜单按钮 */
        .menu-toggle {
            display: none;
            background: var(--primary-color);
            color: white;
            border: none;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            position: fixed;
            left: 20px;
            top: 86px;
            z-index: 1001;
            box-shadow: 0 4px 10px rgba(0,0,0,0.2);
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .menu-toggle:hover {
            transform: scale(1.1);
            background: var(--secondary-color);
        }

        /* 响应式设计 */
        @media (max-width: 992px) {
            .sidebar {
                position: fixed;
                left: -280px;
                top: 76px;
                width: 280px;
                height: calc(100vh - 76px);
                z-index: 999;
            }

            .sidebar.active {
                left: 0;
            }

            .main-content {
                margin: 15px;
                height: calc(100vh - 112px);
            }

            .menu-toggle {
                display: block;
            }

            .overlay {
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: rgba(0,0,0,0.5);
                z-index: 998;
                display: none;
            }

            .overlay.active {
                display: block;
            }
        }

        @media (max-width: 576px) {
            .navbar-brand {
                font-size: 1.2rem;
            }

            .main-content {
                margin: 10px;
                height: calc(100vh - 102px);
            }

            .footer {
                font-size: 0.9rem;
                padding: 10px;
            }
        }
    </style>
</head>
<body>
    <button class="menu-toggle" id="menuToggle">
        <i class="bi bi-list"></i>
    </button>
    <div class="overlay" id="overlay"></div>

    <!-- 顶部导航栏 -->
    <nav class="navbar navbar-expand-lg">
        <div class="container-fluid">
            <a class="navbar-brand" href="#">
                <i class="bi bi-book"></i> 安庆地区方言正音电子词典系统
            </a>

            <div class="navbar-nav ms-auto">
                <div class="user-info">
                    <div class="user-avatar">
                        <i class="bi bi-person"></i>
                    </div>
                    <div class="dropdown">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                            ${sessionScope.username}
                        </a>
                        <ul class="dropdown-menu">
                            <li><span class="dropdown-item-text">权限：[${sessionScope.cx}]</span></li>
                            <li><hr class="dropdown-divider"></li>
                            <li><a class="dropdown-item" href="logout.jsp"><i class="bi bi-box-arrow-right"></i> 退出登录</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </nav>

    <div class="container-fluid flex-grow-1">
        <div class="row h-100">
            <!-- 侧边栏 -->
            <div class="col-md-3 col-lg-2 sidebar" id="sidebar">
                <div class="sidebar-header">
                    <h5><i class="bi bi-gear"></i> 系统管理</h5>
                </div>

                <nav class="nav flex-column">
                    <% if (request.getSession().getAttribute("cx").equals("超级管理员") || request.getSession().getAttribute("cx").equals("管理员")) { %>
                        <div class="nav-section">
                            <div class="nav-section-title">系统管理</div>
                            <a class="nav-link" href="allusers_list.jsp" target="hsgmain">
                                <i class="bi bi-people"></i> 管理员管理
                            </a>
                            <a class="nav-link" href="yonghuxinxi_list.jsp" target="hsgmain">
                                <i class="bi bi-person-badge"></i> 用户管理
                            </a>
                        </div>

                        <div class="nav-section">
                            <div class="nav-section-title">内容管理</div>
                            <a class="nav-link" href="cihuixinxi_list.jsp" target="hsgmain">
                                <i class="bi bi-book"></i> 词汇管理
                            </a>
                            <a class="nav-link" href="liuyanxinxi_list.jsp" target="hsgmain">
                                <i class="bi bi-chat-dots"></i> 留言管理
                            </a>
                            <a class="nav-link" href="tiezi_list.jsp" target="hsgmain">
                                <i class="bi bi-file-text"></i> 帖子管理
                            </a>
                            <a class="nav-link" href="tongzhigonggao_list.jsp" target="hsgmain">
                                <i class="bi bi-megaphone"></i> 公告管理
                            </a>
                        </div>
                    <% } if (request.getSession().getAttribute("cx").equals("用户")) { %>
                        <div class="nav-section">
                            <div class="nav-section-title">用户功能</div>
                            <a class="nav-link" href="cihuixinxi_list2.jsp" target="hsgmain">
                                <i class="bi bi-search"></i> 词汇查询
                            </a>
                            <a class="nav-link" href="liuyanxinxi_list2.jsp" target="hsgmain">
                                <i class="bi bi-chat"></i> 我的留言
                            </a>
                            <a class="nav-link" href="tiezi_list2.jsp" target="hsgmain">
                                <i class="bi bi-file-earmark-text"></i> 我的帖子
                            </a>
                            <a class="nav-link" href="yonghuxinxi_updt2.jsp" target="hsgmain">
                                <i class="bi bi-person-gear"></i> 个人设置
                            </a>
                        </div>
                    <% } %>

                    <div class="nav-section">
                        <div class="nav-section-title">系统功能</div>
                        <a class="nav-link active" href="sy.jsp" target="hsgmain">
                            <i class="bi bi-house"></i> 系统首页
                        </a>
                        <a class="nav-link" href="logout.jsp">
                            <i class="bi bi-box-arrow-right"></i> 退出系统
                        </a>
                    </div>
                </nav>
            </div>

            <!-- 主内容区域 -->
            <div class="col-md-9 col-lg-10">
                <div class="main-content">
                    <iframe src="sy.jsp" name="hsgmain" class="content-frame"></iframe>
                </div>
            </div>
        </div>
    </div>

    <!-- 页脚 -->
    <footer class="footer">
        <div class="container">
            <span>&copy; 2024 安庆地区方言正音电子词典系统 - 欢迎使用本系统</span>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 侧边栏导航激活状态
        document.querySelectorAll('.nav-link').forEach(link => {
            link.addEventListener('click', function() {
                document.querySelectorAll('.nav-link').forEach(l => l.classList.remove('active'));
                this.classList.add('active');

                // 在移动端点击导航后关闭侧边栏
                if (window.innerWidth <= 992) {
                    document.getElementById('sidebar').classList.remove('active');
                    document.getElementById('overlay').classList.remove('active');
                }
            });
        });

        // 移动端菜单切换
        const menuToggle = document.getElementById('menuToggle');
        const sidebar = document.getElementById('sidebar');
        const overlay = document.getElementById('overlay');

        menuToggle.addEventListener('click', function() {
            sidebar.classList.toggle('active');
            overlay.classList.toggle('active');
        });

        overlay.addEventListener('click', function() {
            sidebar.classList.remove('active');
            overlay.classList.remove('active');
        });

        // 窗口大小变化时处理
        window.addEventListener('resize', function() {
            if (window.innerWidth > 992) {
                sidebar.classList.remove('active');
                overlay.classList.remove('active');
            }
        });

        // 页面加载完成后的初始化
        document.addEventListener('DOMContentLoaded', function() {
            // 设置默认激活的导航项
            const defaultLink = document.querySelector('.nav-link[href="sy.jsp"]');
            if (defaultLink) {
                defaultLink.classList.add('active');
            }

            // 添加平滑滚动效果
            document.querySelectorAll('a[href^="#"]').forEach(anchor => {
                anchor.addEventListener('click', function(e) {
                    e.preventDefault();
                    const targetId = this.getAttribute('href');
                    if (targetId !== '#') {
                        document.querySelector(targetId).scrollIntoView({
                            behavior: 'smooth'
                        });
                    }
                });
            });
        });
    </script>
</body>
</html>